import React from 'react'
import { createRoot } from 'react-dom/client'
// import HelloWorld from './components/HelloWorld/index.jsx'
// import CountDown from './components/CountDown/index.jsx'
// import TodoList from './components/TodoList/index.jsx'
import KunKunGame from './components/KunKunGame/index.jsx'
// import './mock/index.js'
import './global.scss'
// import { deleteTodo, getTodoList } from './services/api.js'

class App extends React.Component {
  constructor(props) {
    super(props)
    this.state = {
      // dataSource: [],
    }
  }

  componentDidMount() {
    // this.loadData()
  }

  // loadData = () => {
  //   getTodoList({}).then((res) => {
  //     if (res.success) {
  //       this.setState({
  //         dataSource: res.data,
  //       })
  //     }
  //   })
  // }

  // handleDelete = (id) => {
  //   deleteTodo({ id }).then((res) => {
  //     if (res === true) {
  //       this.loadData()
  //     }
  //   })
  // }

  render() {
    // const { dataSource } = this.state

    return (
      <>
        {/* <HelloWorld /> */}
        {/* <div style={{ display: 'flex', justifyContent: 'center' }}>
          <TodoList
            width={400}
            title="我的待办"
            dataSource={dataSource}
            onDelete={this.handleDelete}
          />
          <TodoList width={400} title="李华的待办" dataSource={dataSource} />
          <CountDown
            onCountDownEnd={() => {
              console.log('倒计时结束了')
            }}
            startTimeStamp={3600000}
          />
        </div> */}
        <KunKunGame />
      </>
    )
  }
}

const container = document.getElementById('root')

// ReactDom.render(
//   <App />,
//   container
// );

// React 18的写法
createRoot(container).render(<App />) // createRoot(container!) if you use TypeScript
